<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>

<style>
	.typeoption{
		width:250px;margin-top:30px;
	}
	.datetimeip{float:left;width:113px;height:20px;background:#eeeeee;border:1px solid #cfcfcf;position:relative;display:block;}
	.datetimeip input.dateip{float:left;width:90px;height:13px;margin-left:5px;margin-top:5px; background:none repeat scroll 0 50% transparent;border:0 none;color: #000000; font-size: 12px;}
	.datetimeip input.buttonicon{float:left;width:20px;height:20px;margin: 6px 0 0 7px;margin: 6px 0 0 4px\9;border:0 none;cursor: pointer;}
	.datetimebt{float:left;width:50px;height:23px;font-size: 12px;background:#006699;border:1px solid #b1c0cb;display:block;text-align:center;font-weight:bold;cursor:pointer;color:#FFF;margin-left:30px;}
	.ui-datepicker-trigger{margin-top:2px;cursor:pointer;}
	
	table.summary{width:99%;float:left;margin-top:15px;margin-bottom:30px;border:1px solid #cfcfcf;}
	table.summary thead td{font-weight:bold;padding-left:10px;background:#eeeeee;border-right:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf;}
	table.summary tbody td{padding-left:10px;border:1px solid #cfcfcf;}
	table tbody tr:nth-child(2n){background:#fff;}
</style>

<?php 
	$ci = & get_instance();
	if(!isUserLogin()){
		redirect(site_url());exit();
	}
	$mode = in_array($this->input->get('mode',FALSE),array('m1','m2')) ? $this->input->get('mode',FALSE):'m1';
	$checked1 = ($mode == 'm1') ? 'checked="checked"':'';
	$checked2 = ($mode == 'm2') ? 'checked="checked"':'';
	$fromDate = $this->input->get('fromDate',FALSE);
	$toDate = $this->input->get('toDate',FALSE);
	
	$statusArray = codStatusDataConfig();
?>
<div id="center_content">
	<div class="clrboth"></div>
	<div class="block">
		<div class="title" style="position:relative;">
			<h3 style="font-weight:bold;"><a href="<?php echo site_url("cricket/user/dashboard")?>">Dashboard</a> &raquo; Cash On Delivery Orders</h3>
			<a class="back_button2" href="<?php echo site_url("cricket/user/dashboard")?>" title="Back?">Back?</a>	
		</div>
		<div class="clrboth"></div>
		<div class="content">
		<div class="rowitem3">
			<form action="<?php echo site_url('cricket/account/my_cod_orders');?>" name="my_cod_orders" id="my_cod_orders" method="get" >
				
				<div class="clrboth" style="height:20px;"></div>
				<div style="float:left;">
					<input type="radio" name="mode" id="last24h" value="m1" <?php echo $checked1;?> /> Last 24 hours
					&nbsp;&nbsp;&nbsp;
					<input type="radio" name="mode" id="sltime" value="m2" <?php echo $checked2;?> /> From
					&nbsp;&nbsp;
				</div>
				<div class="datetimeip" style="margin-left:10px;">
					<input type="text" class="dateip" id="fromDate" name="fromDate" value="<?php echo $fromDate;?>" />
				</div>
				<span class="left" style="margin-left:15px;">to</span>
				<div class="datetimeip" style="margin-left:15px;">
					<input type="text" class="dateip" id="toDate" name="toDate" value="<?php echo $toDate;?>" />
				</div>
				<input type="submit" value="GO" class="datetimebt" />
				 
			</form>	
			<div class="clrboth" style="height:20px;"></div>
			<table class="summary">
				<thead>
					<td width="20%">Order ID</td>
					<td width="20%">Date/Time</td>
					<td width="20%">Price (INR)</td>
					<td width="20%">CX coins</td>
					<td width="20%">Status</td>
				</thead>	
				<tbody>
					<?php foreach($items as $item):?>
						<tr>
							<td width="20%"><?php echo $item->id;?></td>
							<td width="20%"><?php echo sysDateTimeFormat($item->created_time 	,'d/m/Y H:i:s');?></td>
							<td width="20%" style="text-align:right;"><?php echo format_Money($item->price,true);?></td>
							<td width="20%" style="text-align:right;"><?php echo $item->coin;?>&nbsp;</td>
							<td width="20%"><?php echo $statusArray[$item->status];?>&nbsp;</td>
						</tr>
					<?php endforeach;?>
				</tbody>	
			</table>	
		</div>	 
		<div class="clrboth"></div>
		</div>
	</div>	
	<div class="clrboth"></div>
</div>

<script type="text/javascript">
	google.setOnLoadCallback(function(){
		$( "#fromDate,#toDate" ).datepicker({
			changeMonth: true,
			changeYear: true,
			dateFormat: 'dd/mm/yy',
			showOn: "button",
			buttonImage: BASE_URI+"addons/default/themes/clicxa/css/images/calendar.png",
			buttonImageOnly: true,
			buttonText: 'Choose date'
		});
	});
</script>	